.class public Lnet/oauth/signature/pem/PKCS1EncodedKeySpec;
.super Ljava/lang/Object;
.source "PKCS1EncodedKeySpec.java"


# instance fields
.field private keySpec:Ljava/security/spec/RSAPrivateCrtKeySpec;


# direct methods
.method public constructor <init>([B)V
    .locals 0
    .parameter "keyBytes"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 51
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 52
    invoke-direct {p0, p1}, Lnet/oauth/signature/pem/PKCS1EncodedKeySpec;->decode([B)V

    .line 53
    return-void
.end method

.method private decode([B)V
    .locals 12
    .parameter "keyBytes"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 93
    new-instance v9, Lnet/oauth/signature/pem/DerParser;

    invoke-direct {v9, p1}, Lnet/oauth/signature/pem/DerParser;-><init>([B)V

    .line 95
    .local v9, parser:Lnet/oauth/signature/pem/DerParser;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v10

    .line 96
    .local v10, sequence:Lnet/oauth/signature/pem/Asn1Object;
    invoke-virtual {v10}, Lnet/oauth/signature/pem/Asn1Object;->getType()I

    move-result v0

    const/16 v11, 0x10

    if-eq v0, v11, :cond_0

    .line 97
    new-instance v0, Ljava/io/IOException;

    const-string v11, "Invalid DER: not a sequence"

    invoke-direct {v0, v11}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 100
    :cond_0
    invoke-virtual {v10}, Lnet/oauth/signature/pem/Asn1Object;->getParser()Lnet/oauth/signature/pem/DerParser;

    move-result-object v9

    .line 102
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    .line 103
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v1

    .line 104
    .local v1, modulus:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v2

    .line 105
    .local v2, publicExp:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v3

    .line 106
    .local v3, privateExp:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v4

    .line 107
    .local v4, prime1:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v5

    .line 108
    .local v5, prime2:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v6

    .line 109
    .local v6, exp1:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v7

    .line 110
    .local v7, exp2:Ljava/math/BigInteger;
    invoke-virtual {v9}, Lnet/oauth/signature/pem/DerParser;->read()Lnet/oauth/signature/pem/Asn1Object;

    move-result-object v0

    invoke-virtual {v0}, Lnet/oauth/signature/pem/Asn1Object;->getInteger()Ljava/math/BigInteger;

    move-result-object v8

    .line 112
    .local v8, crtCoef:Ljava/math/BigInteger;
    new-instance v0, Ljava/security/spec/RSAPrivateCrtKeySpec;

    invoke-direct/range {v0 .. v8}, Ljava/security/spec/RSAPrivateCrtKeySpec;-><init>(Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;)V

    iput-object v0, p0, Lnet/oauth/signature/pem/PKCS1EncodedKeySpec;->keySpec:Ljava/security/spec/RSAPrivateCrtKeySpec;

    .line 115
    return-void
.end method


# virtual methods
.method public getKeySpec()Ljava/security/spec/RSAPrivateCrtKeySpec;
    .locals 1

    .prologue
    .line 61
    iget-object v0, p0, Lnet/oauth/signature/pem/PKCS1EncodedKeySpec;->keySpec:Ljava/security/spec/RSAPrivateCrtKeySpec;

    return-object v0
.end method
